package com.spc.demo.center;

import com.spc.demo.event.EventA;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;

/**
 * @author pingchao.su
 * @date 2022/6/25 21:18
 */
@Service
public class EventCenter implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher applicationEventPublisher;

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
    }

    public void publishEventA(){
        applicationEventPublisher.publishEvent(new EventA("test"));
    }
}
